Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node.extend

Package Overview
Dependencies
Maintainers
2
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node.extend

A port of jQuery.extend that actually works on node.js

  • 1.1.8
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
497K
decreased by-8.51%
Maintainers
2
Weekly downloads
 
Created

What is node.extend?

The node.extend package is a simple utility for deep and shallow extending (merging) of objects. It is useful for combining multiple objects into one, copying properties from one object to another, and creating new objects with inherited properties.

What are node.extend's main functionalities?

Shallow Extend

This feature allows you to perform a shallow merge of multiple objects. In the example, properties from obj2 overwrite those in obj1 where they conflict.

const extend = require('node.extend');
const obj1 = { a: 1, b: 2 };
const obj2 = { b: 3, c: 4 };
const result = extend({}, obj1, obj2);
console.log(result); // { a: 1, b: 3, c: 4 }

Deep Extend

This feature allows you to perform a deep merge of multiple objects. Nested objects are merged recursively. In the example, the nested properties of obj2 overwrite those in obj1 where they conflict.

const extend = require('node.extend');
const obj1 = { a: 1, b: { x: 1, y: 2 } };
const obj2 = { b: { y: 3, z: 4 }, c: 5 };
const result = extend(true, {}, obj1, obj2);
console.log(result); // { a: 1, b: { x: 1, y: 3, z: 4 }, c: 5 }

Clone Object

This feature allows you to create a deep clone of an object. The example demonstrates cloning an object with nested properties.

const extend = require('node.extend');
const obj = { a: 1, b: { x: 1, y: 2 } };
const clone = extend(true, {}, obj);
console.log(clone); // { a: 1, b: { x: 1, y: 2 } }

Other packages similar to node.extend

Keywords

FAQs

Package last updated on 25 Nov 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc